using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using ADESSA.Entities;
using ADESSA.Business;
using FetCo.Data;
using FetCo.Framework;

public partial class MasterPage : System.Web.UI.MasterPage
{
    ADESSA.Entities.Company _Company = new ADESSA.Entities.Company();
    ADESSA.Entities.Member _Member = new ADESSA.Entities.Member();
    protected void Page_Load(object sender, EventArgs e)
    {
        
        LoadSession();
    }
    #region LoadSession
    private void LoadSession()
    {
        if (Session["MemberId"] != null)
        {
            _Member = MemberService.GetMember(long.Parse(Session["MemberId"].ToString()));
            if (_Member != null)
            {
                ahrReg.HRef = ("MySantilia.aspx");
                ahrReg.InnerText = _Member.FullName;
                linkLogout.Visible = true;
                liSigin.Visible = false;
            }
        }
        else
        {
            ahrReg.InnerText = "Join Free";
            ahrReg.HRef = "RegisterMember.aspx";
            linkLogout.Visible = false;
        }
    }
    
    #endregion
    #region LogOut
    protected void linkLogout_Click(object sender, EventArgs e)
    {
        Session["MemberName"] = null;
        Session["MemberId"] = null;
        Response.Redirect("Default.aspx");
    }
    #endregion
}
